<?php
/* 
 * ebiz front
 * 
 * UtilityView
 * 
 * @author allen
 * 
 */
require_once '../app/controllers/ImageController.php';
require_once '../app/util/TemplateReplaceUtil.php';
require_once '../app/util/TagUtil.php';
require_once '../app/views/HeaderView.php';
require_once '../app/views/FooterView.php';
//require_once '../app/controllers/TemplateController.php';

class UtilityView {
	
	public function render($action = null, $param = null){   
		$mainContent = "";
		if($action == "activeEmailView"){
			$mainContent = self::activeEmailView($param);
		}else if($action == "findPasswordEmailView"){
			$mainContent = self::findPasswordEmailView($param);
		}else if($action == "orderConfirmationEmail"){
            $mainContent = self::findPasswordEmailView($param);
        }
        return $mainContent;
	}
	
	private function activeEmailView($param = array()){    
		$username = $param['name'];
		$link = $param['link'];
		$activeRegisterHtml =
<<<str_result


<table width="651" border="0" cellpadding="0" cellspacing="0" style="font-size:12px;">
  <tr>
    <td width="183" rowspan="2"><img src="http://i.akimimi.com/t/default_zh_cn/image/email/email_05.gif" width="172" height="67"  alt=""/></td>
  </tr>
  <tr>
    <td width="468" background="http://i.akimimi.com/t/default_zh_cn/image/email/email_02.jpg"  style=" padding-left:20px; line-height:18px;">每一天，我们都在为让您更满意而努力~点滴改变，创造完美购物体验！<br />
      阿基米米，全心为您！让您以最低价买到正品行货。 </td>
  </tr>
</table>


<table style="float:left; width:210px; margin-top:20px;font-size:12px;" >
  <tr>
    <td><img src="http://i.akimimi.com/t/default_zh_cn/image/email/email_08.gif" width="165" height="241" alt="" /></td>
  </tr>
</table>

  <table width="430"  border="0" cellpadding="0" cellspacing="0"  style=" font-size:12px;border:solid 1px #CCC; padding:10px; margin:10px; float:left;">
  
    <tr>
      <td colspan="2" style="line-height:20px;">您好,{$username}！恭喜您成为阿基米米网上商城的会员。</td>
    </tr>
    <tr>
      <td colspan="2" style="line-height:20px;"> 我们将为您提供安全、便利、快捷、周到的网络购物服务，</td>
  </tr>
  <tr>
    <td colspan="2" style="line-height:20px;" >努力让您以最低价买到正品行货。祝您在阿基米米网上商城购物愉快！</td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" style="color:#afafaf; font-weight:bold; line-height:20px; ">请在24小时内点击下面的链接，完成邮箱验证，您将立刻获得10个积分。</td>
    </tr>
    <tr>
      <td colspan="2" style="line-height:20px; font-family:Arial, Helvetica, sans-serif;" >
        $link
      </td>
    </tr>
    <tr>
     <td colspan="2" style="line-height:20px; color:#9c9c9c;" >如果您不能点击此链接，请将以上链接复制到浏览器地址栏中访问</td>
    </tr>
    <tr>
      <td width="245" height="120" align="right">阿基米米网上商城</td>
      <td width="202" height="120"><img src="http://i.akimimi.com/t/default_zh_cn/image/email/email_11.gif" width="202" height="96" alt="" /></td>
    </tr>
  </table>

<span style="clear:both"></span>

<table width="650" border="0" cellpadding="0" cellspacing="0" style="font-size:12px;">
  <tr>
    <td colspan="6" bgcolor="#f6f6f6"><img src="http://i.akimimi.com/t/default_zh_cn/image/email/email_16.gif" width="260" height="26" alt="" /></td>
    </tr>
  <tr>
    <td height="120" ><img src="http://pi.akimimi.com/p/p12_4aab5ea4f3025/p1_4aab5ea505326/26679_34385_1_160.jpg" width="98" height="98"  style="border:solid 1px #ccc;" alt=""/></td>
    <td height="120" ><img src="http://pi.akimimi.com/p/p12_4aab5ea4f3025/p1_4aab5ea505326/26679_34385_1_160.jpg" width="98" height="98"  style="border:solid 1px #ccc;" alt=""/></td>
    <td height="120"><img src="http://pi.akimimi.com/p/p12_4aab5ea4f3025/p1_4aab5ea505326/26679_34385_1_160.jpg" width="98" height="98"  style="border:solid 1px #ccc;" alt=""/></td>
       <td height="120" > <img src="http://pi.akimimi.com/p/p12_4aab5ea4f3025/p1_4aab5ea505326/26679_34385_1_160.jpg" width="98" height="98"  style="border:solid 1px #ccc;" alt=""/></td>
    <td height="120" ><img src="http://pi.akimimi.com/p/p12_4aab5ea4f3025/p1_4aab5ea505326/26679_34385_1_160.jpg" width="98" height="98"  style="border:solid 1px #ccc;" alt=""/></td>
    <td height="120" ><img src="http://pi.akimimi.com/p/p12_4aab5ea4f3025/p1_4aab5ea505326/26679_34385_1_160.jpg" width="98" height="98" style="border:solid 1px #ccc;" alt="" /></td>
    
  </tr>
  <tr>
    <td colspan="6" bgcolor="#f6f6f6"><img src="http://i.akimimi.com/t/default_zh_cn/image/email/email_38.gif" width="325" height="26" alt="" /></td>
    </tr>
  <tr>
    <td height="85" colspan="6">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;米米校园团队是一支<span style="color:#79b440;">极具热情</span>和<span style="color:#79b440;">执行力</span>的大学生创业团队，一支保持旺盛的<span style="color:#79b440;">思想力</span>和<span style="color:#79b440;">创造力</span>的年轻团队，也是一支融会了<span style="color:#79b440;">校园文化底蕴</span>和<span style="color:#79b440;">商业价值内涵</span>的精英团队。米米校园团队由了解电子商务，热爱阿基米米，拥有创业激情和理想的在校大学生自行组建。阿基米米旨在与大学生<span style="color:#79b440;">一起创业</span>。</td>
    </tr>

  <tr>
    <td colspan="6" align="center" bgcolor="#F6F6F6" style="color:#30F; line-height:30px;">此信由阿基米米网上商城系统发出，请勿回复。</td>
    </tr>
</table>

str_result;
//      $activeEmailPath = "layout/active_email.scl";   
//      $datascl = TemplateReplaceUtil::getTemplate($activeEmailPath);
//      $datascl = TemplateReplaceUtil::replaceTemplate("{%name%}", $username, $datascl); 
//      $datascl = TemplateReplaceUtil::replaceTemplate("{%link%}", $link, $datascl); 
        return $activeRegisterHtml;
	}
	
	private function orderConfirmationEmail($param = array()){
	   $orderHtml =
<<<str_result
<table style="font-family:'宋体'; font-size:12px; color:#666666;">
        <!-- header begin -->
        <tr>
            <td background="http://i.akimimi.com/t/default_zh_cn/image/email/email_002.jpg" style="width:650px;height:95px;" colspan="2">
                <br/><br/><br/><br/><br/>
                    <span>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </span>
                    <span><a style="text-decoration:none;color:#F0FFEA;" href="http://www.akimimi.com">首页</a></span>&nbsp;&nbsp;&nbsp;
                    <span><a style="text-decoration:none;color:#F0FFEA;" href="http://www.akimimi.com/c/index/mobile_and_accessories">手机</a></span>&nbsp;&nbsp;&nbsp;
                    <span><a style="text-decoration:none;color:#F0FFEA;" href="#">数码相机</a></span>&nbsp;&nbsp;&nbsp;
                    <span><a style="text-decoration:none;color:#F0FFEA;" href="#">时尚女装</a></span>&nbsp;&nbsp;&nbsp;
                    <span><a style="text-decoration:none;color:#F0FFEA;" href="#">化妆品</a></span>
            </td>       
        </tr>
        <!-- header end -->
        <!-- center end -->
        <tr>
            <td>
                <table>
                    <tr style="color:#000000">
                        <td>
                            <span style="font-weight:bold;">亲爱的：<$user_id></span><br/><br/>
                                                                            您的订单<$order_id>已经发货，请您耐心等待，校园大使会尽快与您联系。<br/><br/>
                                                                            订单信息<br/><br/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table  width="440" border="0" align="left" cellpadding="0" cellspacing="1" bgcolor="#F7FFF4">
                                <tr>
                                    <td width="250" height="25" align="center">商品名称</td>
                                    <td width="89" align="center">数量</td>
                                    <td width="73" align="center">单价</td>
                                </tr>
                                <tr>
                                    <td height="25" align="center">纽曼（Newsmy）音影王M521(1GB)黑色</td>
                                    <td align="center">1</td>
                                    <td align="center">￥1250</td>
                                </tr>
                                <tr>
                                    <td height="25" align="center">纽曼（Newsmy）音影王M521(1GB)黑色</td>
                                    <td align="center">1</td>
                                    <td align="center">￥1250</td>
                                </tr>
                                <tr>
                                    <td height="25" align="center">&nbsp;</td>
                                    <td colspan="2" align="center"><h3 style="color:#47A618">合计： ￥1250</h3></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr style="color:#000000;line-height:22px;">
                        <td>
                            <span style="font-weight:bold; color:#FF0000;">温馨提示：</span>
                            您所订购的商品已经发货。阿基米米部分商品由北京库房直接发送，部<br/>
                            分商品由各地分仓发送。为了确保您订购的商品在运输途中不受损害，在发货前，每<br/>
                            一件商品都经过特殊的严密包装，并且托付中国最专业的快递公司负责全程配送。如<br/>
                            果您希望查询商品的运输情况。<br/>                     
                            可以在以下网站查询到您的物流信息：<br />
                            顺丰快递：<a href="http://www.sf-express.com" target="_blank">http://www.sf-express.com</a><br />
                            申通快递：<a href="http://www.sto.cn" target="_blank">http://www.sto.cn</a><br />
                            中通快递：<a href="http://www.zto.cn" target="_blank">http://www.zto.cn</a><br />
                            圆通快递：<a href="http://www.yto.ne.t.cn" target="_blank">http://www.yto.ne.t.cn</a><br />
                            韵达快递：<a href="http://www.yundaex.com" target="_blank">http://www.yundaex.com</a><br /><br />
                            欢迎您再次到阿基米米购物，祝您购物愉快！
                            <br/><br/><br/><br/>
                        </td>
                    </tr>
                </table>
            </td>
            <td style="width:175px;" valign="top">
                <img src="http://i.akimimi.com/t/default_zh_cn/image/email/email_007.jpg"  alt=""/>
            </td>
        </tr>
        <!-- center end -->
        <!-- center begin -->
        <tr>
            <td colspan="2" valign="top">
                <img src="http://i.akimimi.com/t/default_zh_cn/image/email/email_001.jpg" alt="" />
            </td>
        </tr>
        <!-- center end -->
    </table>    <table style="font-family:'宋体'; font-size:12px; color:#666666;">
        <!-- header begin -->
        <tr>
            <td background="images/email_002.jpg" style="width:650px;height:95px;" colspan="2">
                <!--<p style="position:absolute;top:73px;left:300px;width:400px;">-->
                <br/><br/><br/><br/><br/>
                    <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                    <span><a style="text-decoration:none;color:#F0FFEA;" href="http://www.akimimi.com">首页</a></span>&nbsp;&nbsp;&nbsp;
                    <span><a style="text-decoration:none;color:#F0FFEA;" href="#">手机</a></span>&nbsp;&nbsp;&nbsp;
                    <span><a style="text-decoration:none;color:#F0FFEA;" href="#">数码相机</a></span>&nbsp;&nbsp;&nbsp;
                    <span><a style="text-decoration:none;color:#F0FFEA;" href="#">时尚女装</a></span>&nbsp;&nbsp;&nbsp;
                    <span><a style="text-decoration:none;color:#F0FFEA;" href="#">化妆品</a></span>
                
            </td>       
        </tr>
        <!-- header end -->
        <!-- center end -->
        <tr>
            <td>
                <table>
                    <tr style="color:#000000">
                        <td>
                        <span style="font-weight:bold;">亲爱的：<user_id></span><br/><br/>
                        您的订单<order_id>已经发货，请您耐心等待，校园大使会尽快与您联系。<br/><br/>
                        订单信息<br/><br/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table  width="440" border="0" align="left" cellpadding="0" cellspacing="1" bgcolor="#F7FFF4">
                                <tr>
                                    <td width="250" height="25" align="center">商品名称</td>
                                    <td width="89" align="center">数量</td>
                                    <td width="73" align="center">单价</td>
                                </tr>
                                <tr>
                                    <td height="25" align="center">纽曼（Newsmy）音影王M521(1GB)黑色</td>
                                    <td align="center">1</td>
                                    <td align="center">￥1250</td>
                                </tr>
                                <tr>
                                    <td height="25" align="center">纽曼（Newsmy）音影王M521(1GB)黑色</td>
                                    <td align="center">1</td>
                                    <td align="center">￥1250</td>
                                </tr>
                                <tr>
                                    <td height="25" align="center">&nbsp;</td>
                                    <td colspan="2" align="center"><h3 style="color:#47A618">合计： ￥1250</h3></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr style="color:#000000;line-height:22px;">
                        <td>
                            <span style="font-weight:bold; color:#FF0000;">温馨提示：</span>
                            您所订购的商品已经发货。阿基米米部分商品由北京库房直接发送，部<br/>
                            分商品由各地分仓发送。为了确保您订购的商品在运输途中不受损害，在发货前，每<br/>
                            一件商品都经过特殊的严密包装，并且托付中国最专业的快递公司负责全程配送。如<br/>
                            果您希望查询商品的运输情况。<br/>                     
                            可以在以下网站查询到您的物流信息：<br />
                            顺丰快递：<a href="http://www.sf-express.com" target="_blank">http://www.sf-express.com</a><br />
                            申通快递：<a href="http://www.sto.cn" target="_blank">http://www.sto.cn</a><br />
                            中通快递：<a href="http://www.zto.cn" target="_blank">http://www.zto.cn</a><br />
                            圆通快递：<a href="http://www.yto.ne.t.cn" target="_blank">http://www.yto.ne.t.cn</a><br />
                            韵达快递：<a href="http://www.yundaex.com" target="_blank">http://www.yundaex.com</a><br /><br />
                            欢迎您再次到阿基米米购物，祝您购物愉快！
                        </td>
                    </tr>
                </table>
            </td>
            <br/><br/><br/><br/>
            <td style="width:175px;;">
                <img src="images/email_007.jpg"  alt=""/>
            </td>
        </tr>
        <!-- center end -->
        <!-- center begin -->
        <tr>
            <td colspan="2">
                <img src="images/email_001.jpg" alt="" />
            </td>
        </tr>
        <!-- center end -->
    </table>
str_result;
        
        return $orderHtml;
	}
	
	private function findPasswordEmailView($param = array()){ 
        $username = $param['name'];
        $link = $param['link'];
        $activeEmailPath = "layout/findpwd_email.scl";   
        $datascl = TemplateReplaceUtil::getTemplate($activeEmailPath);
        $datascl = TemplateReplaceUtil::replaceTemplate("{%name%}", $username, $datascl); 
        $datascl = TemplateReplaceUtil::replaceTemplate("{%link%}", $link, $datascl); 
        return $datascl;
	}
	
}


